package com.xjx.account.service;

import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

/**
 * * @Author xujunxia
 * * @Date 2024-10-11 9:54
 * * @Description TODO
 * * xujunxia.xjx@bitsun-inc.com
 **/
public interface FileService {


    String getBucketName();

    boolean createBucket(String bucketName);


    boolean bucketExists(String bucketName);

    /**
     * 删除单个文件
     * @param bucketName
     * @param objectName
     * @return
     */
     boolean removeFile(String bucketName, String objectName);

    boolean removeFileByUrl(String fileUrl);

    /**
     * 批量删除文件
     * @param bucketName
     * @param fileNames
     * @return
     */
     boolean  removeFiles(String bucketName, List<String> fileNames);


    /**
     * 上传文件并返回url链接
     * @param file
     * @return
     */
     String uploadFile(MultipartFile file);


     InputStream  getInputStreamByUrl(String fileUrl);

     String sendImgToMinio(String imgUrl);


     String getFileNameFromUrl(String path);

    /**
     * 上传文件并返回url链接
     * @param inputStream
     * @param bucketName
     * @param objectName
     * @return
     */
    String uploadFile(InputStream inputStream, String bucketName, String objectName,boolean defaultReportBucket);

    String uploadFile(InputStream inputStream, String bucketName, String objectName,boolean defaultReportBucket,String folderPath);

    /**
     * 判断文件是否存在
     * @param bucketName
     * @param objectName
     * @return
     */
     boolean isObjectExist(String bucketName, String objectName);



    List<String> listAllObjects(String bucketName);




    String getObject(String bucketName, String objectName);

    public void uploadFile(String bucketName,String filePath);

    String getObject(String fileUrl);

    void uploadFolder(String bucketName, String folderPath);

    void downLoadFolder(String bucketName, String folderPath,String downloadLocationPath);


//    List<CommonDataModel> getDataFromExcel(File file, String tableName);

    File downLoadSingleFile(String bucketName, String fileUrl, String downloadLocationPath);

    File downLoadSingleFile(String bucketName, String fileUrl, String downloadLocationPath,String minioPath);

    void makeDir(String bucketName, String folderPath);


}
